package com.ehome.poct.terminal.controller;

import cn.hutool.json.JSONUtil;
import com.ehome.poct.core.api.dto.check.AlgoLocalDataDTO;
import com.ehome.poct.core.api.vo.check.CheckProcessResultVO;
import com.ehome.poct.terminal.service.CheckService;
import com.ehome.web.annotation.RequestLog;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 血常规 离线版本
 *
 * @author cq
 * @since 2022/03/02 11:21
 **/
@Api(tags = "离线版-检测流程")
@ApiSupport(author = "cq")
@RequestMapping("/offlinecheck")
@RestController
@AllArgsConstructor
@Slf4j
public class OffLineController {

    private final CheckService checkServ;

    @ApiOperation("检测处理")
    @ApiOperationSupport(author = "cq")
    @PostMapping("/startCheck")
    @RequestLog
    public CheckProcessResultVO doCheckProcess(@Valid @RequestBody AlgoLocalDataDTO param) {
        log.info("offline start check request body:[{}]: ", JSONUtil.toJsonStr(param));
        return checkServ.algoNotifyLocal(param);

//        return new CheckProcessResultVO().setDataId(1551820906927296514L)
//                .setExtendInfo(null)
//                .setStripName("血常规检测")
//                .setStripTypeCode(100L).setWarningTips("");

    }
}
